//
//  ZhuCeViewController.m
//  UI_HLJ_Frame
//
//  Created by dlios on 15-7-2.
//  Copyright (c) 2015年 毕宏伟. All rights reserved.
//

#import "ZhuCeViewController.h"

#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
@interface ZhuCeViewController ()<UITextFieldDelegate>

@property(nonatomic, retain)UITextField *textFieldNC;
@property(nonatomic, retain)UITextField *textFieldMM;
@property(nonatomic, retain)UITextField *textFieldQR;

@property(nonatomic, retain)UIButton *buttonBC;
@property(nonatomic, retain)UIButton *buttonQX;


@end


@implementation ZhuCeViewController

- (void)dealloc
{
    [_textFieldNC release];
    [_textFieldMM release];
    [_textFieldQR release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"注册";
    [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"登陆的背景图片"]]];
    
    
    // 建立3个label
    // 昵称
    UILabel *labelNC = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH * 0.5 / 3, HEIGHT * 2 / 10, WIDTH * 2 / 10, HEIGHT * 1.5 / 20)];
    [self.view addSubview:labelNC];
//    labelNC.backgroundColor = [UIColor orangeColor];
    labelNC.text = @"* 昵称 :";
    labelNC.textColor = [UIColor redColor];
    labelNC.font = [UIFont systemFontOfSize:18];
    [labelNC release];
    
    // 密码
    UILabel *labelMM = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH * 0.5 / 3, HEIGHT * 3 / 10, WIDTH * 2 / 10, HEIGHT * 1.5 / 20)];
    [self.view addSubview:labelMM];
//    labelMM.backgroundColor = [UIColor orangeColor];
    labelMM.text = @"* 密码 :";
    labelMM.textColor = [UIColor redColor];
    labelMM.font = [UIFont systemFontOfSize:18];
    [labelMM release];
    
    // 确认密码
    UILabel *labelQR = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH * 0.5 / 3, HEIGHT * 4 / 10, WIDTH * 3 / 10, HEIGHT * 1.5 / 20)];
    [self.view addSubview:labelQR];
//    labelQR.backgroundColor = [UIColor orangeColor];
    labelQR.text = @"* 确认密码 :";
    labelQR.textColor = [UIColor redColor];
    labelQR.font = [UIFont systemFontOfSize:18];
    [labelQR release];
    
    
    // 建立3个textField
    // 昵称textField
    self.textFieldNC = [[UITextField alloc] initWithFrame:CGRectMake(WIDTH * 1 / 2, HEIGHT * 2 / 10, WIDTH * 4 / 10, HEIGHT * 1.2 / 20)];
    [self.view addSubview:self.textFieldNC];
//    self.textFieldNC.backgroundColor = [UIColor orangeColor];
    self.textFieldNC.layer.borderWidth = 1;
    self.textFieldNC.layer.cornerRadius = 10;
    self.textFieldNC.delegate = self;
    self.textFieldNC.placeholder = @"请输入昵称";
    self.textFieldNC.clearButtonMode = UITextFieldViewModeAlways;
    [_textFieldNC release];
    
    // 密码textField
    self.textFieldMM = [[UITextField alloc] initWithFrame:CGRectMake(WIDTH * 1 / 2, HEIGHT * 3 / 10, WIDTH * 4 / 10, HEIGHT * 1.2 / 20)];
    [self.view addSubview:self.textFieldMM];
//    self.textFieldMM.backgroundColor = [UIColor orangeColor];
    self.textFieldMM.layer.borderWidth = 1;
    self.textFieldMM.layer.cornerRadius = 10;
    self.textFieldMM.delegate = self;
    self.textFieldMM.placeholder = @"请输入密码";
    self.textFieldMM.clearButtonMode = UITextFieldViewModeAlways;
    self.textFieldMM.secureTextEntry = YES;
    [_textFieldMM release];
    
    // 确认密码textField
    self.textFieldQR = [[UITextField alloc] initWithFrame:CGRectMake(WIDTH * 1 / 2, HEIGHT * 4 / 10, WIDTH * 4 / 10, HEIGHT * 1.2 / 20)];
    [self.view addSubview:self.textFieldQR];
    self.textFieldQR.layer.borderWidth = 1;
    self.textFieldQR.layer.cornerRadius = 10;
//    self.textFieldQR.backgroundColor = [UIColor orangeColor];
    self.textFieldQR.delegate = self;
    self.textFieldQR.placeholder = @"请再次输入密码";
    self.textFieldQR.clearButtonMode = UITextFieldViewModeAlways;
    self.textFieldQR.secureTextEntry = YES;
    [_textFieldQR release];
    
    
    // 建立2个button
    // 保存按钮
    self.buttonBC = [UIButton buttonWithType:UIButtonTypeSystem];
    self.buttonBC.frame = CGRectMake(WIDTH * 0.7 / 3, HEIGHT * 5 / 10, WIDTH * 2 / 10, HEIGHT * 1 / 20);
    [self.view addSubview:self.buttonBC];
    self.buttonBC.layer.borderWidth = 1;
    self.buttonBC.layer.cornerRadius = 10;
    [self.buttonBC setTitle:@"确定" forState:UIControlStateNormal];
    [self.buttonBC addTarget:self action:@selector(clickBC:) forControlEvents:UIControlEventTouchUpInside];
    
    // 取消按钮
    self.buttonQX = [UIButton buttonWithType:UIButtonTypeSystem];
    self.buttonQX.frame = CGRectMake(WIDTH * 1.8 / 3, HEIGHT * 5 / 10, WIDTH * 2 / 10, HEIGHT * 1 / 20);
    [self.view addSubview:self.buttonQX];
    self.buttonQX.layer.borderWidth = 1;
    self.buttonQX.layer.cornerRadius = 10;
    [self.buttonQX setTitle:@"取消" forState:UIControlStateNormal];
    [self.buttonQX addTarget:self action:@selector(clickQX:) forControlEvents:UIControlEventTouchUpInside];
    
}

// 确定按钮的跳转,返回上一页
- (void)clickBC:(UIButton *)button{
    
    
    
    [self.navigationController popViewControllerAnimated:YES];
    
}


// 取消按钮的跳转,返回上一页
- (void)clickQX:(UIButton *)button{
    
    [self.navigationController popViewControllerAnimated:YES];
    
}




#pragma mark 点击空白回收键盘
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    
    [self.textFieldNC resignFirstResponder];
    [self.textFieldMM resignFirstResponder];
    [self.textFieldQR resignFirstResponder];
    

}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
